import request from "@/utils/request";

// 查询商品分类列表
export function getSkuCategoryInfoList() {
  return request({
    url: "/admin/skuCategoryController/getSkuCategoryInfoList",
    method: "get",
  });
}

//新增商品分类
export function saveSkuCategoryInfo(data) {
  return request({
    url: "/admin/skuCategoryController/saveSkuCategoryInfo",
    method: "post",
    data: data,
  });
}

//删除商品分类
export function removeSkuCategoryInfo(id) {
  return request({
    url: "/admin/skuCategoryController/removeSkuCategoryInfo?id=" + id,
    method: "delete",
  });
}

// 修改商品分类
export function updateSkuCategoryInfo(data) {
  return request({
    url: "/admin/skuCategoryController/updateSkuCategoryInfo",
    method: "post",
    data: data,
  });
}

// 查询商品详情列表
export function getSkuInfoList(query) {
  return request({
    url: "/admin/skuInfoController/getSkuInfoList",
    method: "get",
    params: query,
  });
}

// 新增商品详情
export function saveSkuInfo(data) {
  return request({
    url: "/admin/skuInfoController/saveSkuInfo",
    method: "post",
    data: data,
  });
}

//图片上传
export function uploadImg(data) {
  return request({
    url: "/admin/upload/uploadImg/2",
    method: "post",
    data: data,
  });
}

// 上架商品
export function putOnGoods(skuGoodsId) {
  return request({
    url: "/admin/skuInfoController/putOnGoods?skuGoodsId=" + skuGoodsId,
    method: "get",
  });
}
// 下架商品
export function putDownGoods(skuGoodsId) {
  return request({
    url: "/admin/skuInfoController/putDownGoods?skuGoodsId=" + skuGoodsId,
    method: "get",
  });
}

// 修改商品详情
export function updateGoodsInfo(data) {
  return request({
    url: "/admin/skuInfoController/updateGoodsInfo",
    method: "put",
    data: data,
  });
}
// 删除商品详情
export function removeSkuInfo(id) {
  return request({
    url: "/admin/skuInfoController/removeSkuInfo?id=" + id,
    method: "delete",
  });
}
// 必中用户列表
export function mustUserList(query) {
  return request({
    url: "/admin/raffleGoodsUserController/getRaffleQualificationUserVoByGoodsId",
    method: "get",
    params: query,
  });
}
// 新增用户必中
export function addUserMust(query) {
  return request({
    url: "/admin/raffleGoodsUserController/saveRaffleQualificationUser",
    method: "get",
    params: query,
  });
}
// 查询顶部商品参数
export function getGoods(id) {
  return request({
    url:
      "/admin/raffleGoodsUserController/getRaffleQualificationUserByUserId?goodsId=" +
      id,
    method: "get",
  });
}
export function getsUerGoods(id) {
  return request({
    url:
      "/admin/raffleGoodsUserController/getRaffleQualificationUserVoByUserAccount?userId=" +
      id,
    method: "get",
  });
}
// 删除
export function delUserGoods(id) {
  return request({
    url:
      "/admin/raffleGoodsUserController/deleteRaffleQualificationUserById?id=" +
      id,
    method: "get",
  });
}
// 修改中奖率
export function updateRaffle(data) {
  return request({
    url: "/admin/raffleGoodsRatioController/updateRaffleGoodsRatioById",
    method: "post",
    data: data,
  });
}
